<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<sfa:mainTitle></sfa:mainTitle>
		<%@ include file="../../../common/meta.jsp"%>
 
		<link rel="stylesheet" href="${path }/css/jquery.autocomplete.css"
				type="text/css"></link>
			<script type="text/javascript"
				src="${path }/script/jquery.autocomplete.js">
</script>
		<style type="text/css">
.title {
	width: 200px;
	white-space: nowrap;
	word-break: keep-all;
	overflow: hidden;
	text-overflow: ellipsis;
}

</style>
<script type="text/javascript">
$(function() {
 	$(".delprospectus").click(function() {
		var saleproviderplanbookid = $(this).attr("val");
		var url = "${path}/productandtrain/prospectus/index/del/" +saleproviderplanbookid;
		art.dialog( {
			lock : true,
			content : '确定要删除吗?',
			ok : function() {
				art.dialog( {
					id : "loading",
					lock : true,
					drag : false,
					resize : false,
					title : "正在删除..."
				});
				$.post(url, null, function(result) {
					art.dialog( {
						id : 'loading'
					}).close();//关闭等待框
					 
						if (result == "true") {
							art.dialog( {
								icon : "succeed",
								content : "删除成功!",
								lock : true,
								ok : function() {
									location.reload();
								}
							});
						} else {
							art.dialog( {
								icon : "error",
								content : "删除失败!",
								lock : true,
								ok : true
							});
						}

					});
				return true;
			},
			cancelVal : '关闭',
			cancel : true
		//为true等价于function(){}
				});
	});
});	
$(document).ready(function() {
	
		var requestUrl = "${path}/common/index/getprovider";
		var Url = "${path}/common/index/getproduct";
		$.ajax( {
			type : "post",//默认为get   
			dataType : "json",
			url : requestUrl,
			success : function(providerList) {
			// 供应商
				$("#providername").autocomplete(providerList, {
					minChars : 0,
					max : 200,
					width : 200,
					matchContains : "word",
					autoFill : true,
					formatItem : function(row, i, max) {
						return row.providercode + ":" + row.providerabbr;
					},
					formatMatch : function(row, i, max) {
						return row.providercode + ":" + row.providerabbr;
					},
					formatResult : function(row) {
						return row.providercode + ":" + row.providerabbr;
					}
				});	
			}
		});
		$.ajax( {
			type : "post",//默认为get   
			dataType : "json",
			url : Url,
			success : function(providerList) {
				 
				//产品名称
				$("#productname").autocomplete(providerList, {
					minChars : 0,
					max : 200,
					width : 200,
					matchContains : "word",
					autoFill : true,
					formatItem : function(row, i, max) {
						return row.productname;
					},
					formatMatch : function(row, i, max) {
						return row.productname;
					},
					formatResult : function(row) {
						return row.productname;
					}
				});
			}
		});
	});
</script>
	</head>
	<body id="master">
		<sfa:mainHeader></sfa:mainHeader>
		<div class="webpart3 contentarea">
			<div class="webpart-head">
				<div class="webpart-head-item">
					供应商计划书
					<div class="tools-btn">
						<a href="${path}/productandtrain/prospectus/index/add"><span>
								<img src="${path}/statics/images/add2.gif"
									style="margin-right: 4px;" />新建</span> </a>
									</div>
				</div>
			</div>
			<div class="webpart-main">
				<div class="webpart-main-item" style="padding-top: 12px;">
					<div class="search">
						<form method="get">
							<table cellpadding="0" cellspacing="0" align="center">
								<tr>
									<td>
										建议书名称:	
									</td>
									<td>
										<input type="text" name="planbookname" id="planbookname"
											class="input-txt" value="${planbookname}" " />
									</td>
									<td>
										产品名称：
									</td>
									<td>
										<input type="text" name="productname" id="productname"
											class="input-txt" value="${productname}" />
									</td>
									<th>
										供应商：
									</td>
									<td>
										<input type="text" name="providername" id="providername"
											class="input-txt" value="${providername}" />
									</td>
									<td>
									<input type="submit" class="linkbtn2" value="查询" />
									</td>
									
								</tr>
								
								<tr>	
									<td>
										机构:
									</td>
									<td>
										<select class="selectbox" name="branchId" id="branchId">
											<option value="ALL">
												全部
											</option>
											<c:forEach items="${BranchList}" var="branch">
												<option value="${branch.branchId }"
													<c:if test="${branchId==branch.branchId }">selected='selected'</c:if>>
													${branch.branchName}
												</option>
											</c:forEach>
										</select>
									</td>
									<td colspan="5" align="right">
									<input type="button" class="linkbtn2" value="重置"
											onclick="location.href='${path}/productandtrain/prospectus/index';" />
									</td>
									
 						</tr>	 
								</tr>
							</table>
						</form>
					</div>
					<table cellpadding="0" cellspacing="0"
						class="dg_borderstyle trStyleTable" style="margin-top: 15px;">
						<tr>
							<th>
								序号
							</th>
							<th>
								建议书名称
							</th>
							<th>
								产品代码
							</th>
							<th>
								产品名称
							</th>
							<th>
								供应商
							</th>
							<th>
								机构
							</th>
							<th>
								操作
							</th>
						</tr>

						<c:forEach items="${pagination.resultList}" var="planBook" varStatus="ind">
							<tr>
								<td align="center">
									${(pagination.page-1)*10+(ind.index+1)}
								</td>
								<td align="center">
								<div
										style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100px;"
										title="${planBook.planbookname}">
									<a href="${path}/productandtrain/prospectus/index/info/${planBook.saleproviderplanbookid}">
									${planBook.planbookname}</a>
									</div>
								</td>
								<td align="center">
									${planBook.productCode}
								</td>
								<td align="center">
								<div
										style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 80px;"
										title="${planBook.productname}">
									${planBook.productname}
									</div>
								</td>
								<td align="center">
								 
									${planBook.providername}
								</td>
								<td align="center">
								 ${planBook.branchname}
								</td>
								<td align="center">
									<a href="${path}/productandtrain/prospectus/index/edit/${planBook.saleproviderplanbookid}">修改</a> | 
								<a class="delprospectus" href="javascript:void(0);" val="${planBook.saleproviderplanbookid}" >删除</a>
								</td>
							</tr>
						</c:forEach>

					</table>
					<!----------- 翻页导航 ------------------>
					<div class="dg_pagerstyle">
						<div class="pageinfo">
							<c:if test="${not empty pagination.multiPage}">
							   第${pagination.page }页 | 共${pagination.totalPages }页/${pagination.totalRows }条记录
						</c:if>
						</div>
						<div class="pagebtn">
							${pagination.multiPage}
						</div>
					</div>
					</div>
					<div class="webpart-foot">
						<div class="webpart-foot-item">
						</div>
					</div>
				</div>
			</div>
			<sfa:mainFooter></sfa:mainFooter>
	</body>
</html>